package routes

import (
	"github.com/gin-gonic/gin"
	"one-project/controller"
)

func SetupRoutes() *gin.Engine {
	r := gin.Default()

	testGroup := r.Group("test")
	{
		testGroup.GET("/hello", controller.SayHello)
		testGroup.GET("/asciiJson", controller.AsciiJson)
	}

	v1Group := r.Group("v1")
	{
		//添加todo
		v1Group.POST("/todo", controller.AddSingleTodo)

		//查看ToDoList
		v1Group.GET("/todo", controller.GetTodoList)

		//查看某一个ToDo
		v1Group.GET("/todo/:id", controller.GetSingleTodo)

		//更新一个Todo
		v1Group.PUT("/todo/:id", controller.UpdateSingleTodo)

		//删除一个Todo
		v1Group.DELETE("/todo/:id", controller.DeleteSingleTodo)
	}

	return r
}
